using OrderingFoot.Core;
using OrderingFoot.DbContextCore;

var builder = WebApplication.CreateBuilder(args);
builder.Host.UseLog<Program>(builder.Logging);

// Add services to the container.
builder.Services.AddServiceCore<OrderingFootDbContext>(builder.Configuration);
builder.Services.AddHttpClient();
builder.Services.AddSingleton<ICurrentInfo, CurrentInfo>();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseLoggerMiddleware();
app.UseRedLock(app.Lifetime);
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
